import { defineStore } from 'pinia'
import { ref } from 'vue'
export const useSetUpStore = defineStore(
  'set-up',
  () => {
    // 主题 1：浅色，2：深色，3：根据时间自动切换
    const themeIndex = ref(1)
    const setThemeIndex = (index) => {
      themeIndex.value = index
    }
    const getThemeIndex = () => {
      return themeIndex.value
    }

    const lightTime = ref(['07', '00']) // 浅色风格时间
    const darkTime = ref(['18', '00']) // 深色风格时间
    const setLightTime = (time) => {
      lightTime.value = time
    }
    const getLightTime = () => {
      return lightTime.value
    }
    const setDarkTime = (time) => {
      darkTime.value = time
    }
    const getDarkTime = () => {
      return darkTime.value
    }
    // 定时关闭相关
    const closingMode = ref('立即关闭') // 关闭模式
    const setClosingMode = (mode) => {
      closingMode.value = mode
    }
    const getClosingMode = () => {
      return closingMode.value
    }
    return {
      themeIndex,
      setThemeIndex,
      getThemeIndex,
      lightTime,
      darkTime,
      setLightTime,
      getLightTime,
      setDarkTime,
      getDarkTime,
      closingMode,
      setClosingMode,
      getClosingMode
    }
  },
  {
    persist: true // 持久化
  }
)
